package com.mxm.mirai;

import com.mxm.mirai.service.impl.BotgroupsServiceImpl;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@MapperScan("com.mxm.mirai.mapper.*")
@SpringBootApplication
@EnableSwagger2
public class Application extends SpringBootServletInitializer{
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
        System.out.println("=============启动成功===============");
    }
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        // 注意这里要指向原先用main方法执行的Application启动类
        return builder.sources(Application .class);
    }
    @Bean
    public CommandLineRunner demoData(BotgroupsServiceImpl service) {
        //项目启动时会执行这里的任务
        //通常加载用于系统参数加载
        return args -> {
            service.DeleteBotGroupsBytaskAnd200();
            System.out.println("=============清除200登录状态=============");
        };
    }
}